//
//  HYOUBaseCollectionView.m
//  BestGift
//
//  Created by 温晓宇 on 15/12/29.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "HYOUBaseCollectionView.h"

@implementation HYOUBaseCollectionView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
                [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
                NSString *states = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
                if ([states isEqualToString:@"yes"]) {
                    self.backgroundColor = NIGHT_COLOR;
                }
    }
        return self;
}
-(void)changeColor:(NSNotification *)notification{

        UIColor *color = [notification object];
        self.backgroundColor = color;
}
@end
